package com.cxhome.cxinfox.accountRecord;

import com.jfinal.plugin.activerecord.Page;
import com.traffic.managent.annotation.ControllerBind;
import com.traffic.managent.base.CxBaseController;
import com.traffic.managent.model.account.Account;
import com.traffic.managent.util.StringUtils;

/**
 * 充值记录管理
 *test33
 */
@ControllerBind(controllerKey = "/system/accountrecord")
public class AccountController extends CxBaseController {

	private static final String path = "/pages/system/accountrecord/accountrecord_";

	public void index() {
		list();
	}

	public void list() {
		Account model = getModelByAttr(Account.class);

		String customerId = getSessionUser().getStr("customerId");
		String departmentId = getSessionUser().getStr("departmentId");

		String orderSql = "";
		// 排序
		String orderBy = getBaseForm().getOrderBy();
		if (StringUtils.isEmpty(orderBy)) {
			orderSql += "  order by tempA.createTime desc";
		} else {
			orderSql += "  order by tempA." + orderBy.trim();
		}

		Page<Account> page = AccountService.service.paginate(model, getPaginator(), orderSql, customerId, departmentId);

		setAttr("page", page);
		setAttr("attr", model);
		render(path + "list.html");
	}
	
	

}
